import request from '@/utils/request'
import Qs from 'qs'

export function leaseList(query) {
  return request({
    method: 'get',
    params: {
      _gp: 'admin.lease',
      _mt: 'list',
      ...query
    }
  })
}

export function deleteLease(id) {
  return request({
    method: 'post',
    params: {
      _gp: 'admin.lease',
      _mt: 'delete',
      id: id
    }
  })
}

export function batchDeleteLease(ids) {
  return request({
    method: 'post',
    data: Qs.stringify({
      _gp: 'admin.lease',
      _mt: 'batchDelete',
      ids: JSON.stringify(ids)
    })
  })
}

export function createLease(data) {
  return request({
    method: 'post',
    data: Qs.stringify({
      _gp: 'admin.lease',
      _mt: 'create',
      leaseDO: JSON.stringify(data)
    })
  })
}

export function editLease(data) {
  return request({
    method: 'post',
    data: Qs.stringify({
      _gp: 'admin.lease',
      _mt: 'update',
      leaseDO: JSON.stringify(data)
    })
  })
}

export function detailLease(id) {
  return request({
    method: 'get',
    params: {
      _gp: 'admin.lease',
      _mt: 'detail',
      id: id
    }
  })
}

export function selectCategory() {
  return request({
    method: 'get',
    params: {
      _gp: 'admin.lease',
      _mt: 'select'
    }
  })
}
